//package org.ccay.manage.log.service.impl;
//
//import java.io.File;
//import java.util.Map;
//
//import javax.inject.Inject;
//import javax.inject.Named;
//
//import www.ccay.org.ccay.core.exception.ApplicationException;
//import www.ccay.org.ccay.core.io.FileInfoVO;
//import www.ccay.org.ccay.core.request.RequestConstants;
//import www.ccay.org.ccay.core.util.NetSecurityUtil;
//import www.ccay.org.ccay.core.util.PathUtil;
//import www.ccay.org.ccay.download.support.IDownloadSupport;
//import org.ccay.log.service.IServerLogService;
//import www.ccay.org.ccay.security.SecurityConstants;
//import www.ccay.org.ccay.security.service.IPersonalPermissionService;
//
///**
// * 服务器日志下载servlet
// * 
// * @author chaowangbang
// * @since 2012-2-1
// */
//@Named("IDownloadSupport.ServerLog")
//public class ServerLogDownloadSupport implements IDownloadSupport {
//	@Inject
//	IPersonalPermissionService personalPermissionService;
//	@Inject
//	IServerLogService serverLogService;
//	/*
//	 * (non-Javadoc)
//	 * 
//	 * @see www.ccay.org.ccay.download.support.IDownloadSupport#getFileInfo(java.util.Map)
//	 */
//	public FileInfoVO getFileInfo(Map<String, String> map) throws ApplicationException {
//		FileInfoVO file = new FileInfoVO();
//		// 取服务器名和文件名
//		String serverNameHashcode = map.get("serverName");
//		String fileNameHashcode = map.get("logName");
//		String serverName =null;
//		String fileName =null;
//		 
//		int serverHashcode = new Integer(serverNameHashcode);
//		serverName = serverLogService.findServerName(serverHashcode);
//		fileName = serverLogService.findLogFileName(serverHashcode, new Integer(fileNameHashcode));
//		 
//		 /**
//		 * 检测安全风险
//		 */
//		NetSecurityUtil.checkFileName(serverName);
//		NetSecurityUtil.checkFileName(fileName);
//		 
//		File logFile = new File(PathUtil.getLogPath(serverName),fileName);
//
//		file.setFilePath(logFile.getPath());
//		file.setDisplayName(fileName);
//		return file;
//	}
//
//	/*
//	 * (non-Javadoc)
//	 * 
//	 * @see www.ccay.org.ccay.download.support.IDownloadSupport#validatePrivilege(java.util.Map)
//	 */
//	public boolean validatePrivilege(Map<String, String> map) {
//		return personalPermissionService.hasPermission(
//				SecurityConstants.SECURITY_RESOURCE_TYPE_SERVICE,
//				"Logs.Server", RequestConstants.READ);
//	}
//
//}
